import  torch.nn as nn
import  torch

# # pool of square window of size=3, stride=2
# m0 = nn.MaxPool2d(3, stride=2)
# # pool of non-square window
# m = nn.MaxPool2d((3, 2), stride=(2, 1))
# input = torch.randn(1, 4, 5)
# print(input)
# output = m(input)
# print(output)
#
# output = m0(input)
# print(output)

# 创建输入张量
input_tensor = torch.randn(10, 1, 32, 32)  # 输入通道数为3，输入特征图尺寸为32x32，相当于有3个32x32的矩阵，也就是一张图片

# 创建3x3卷积层
conv3x3 = nn.Conv2d(1, 64, kernel_size=3, padding=1)  # 表明输入通道是3，输出通道是64

# 进行3x3卷积操作
output = conv3x3(input_tensor)

# 打印输出特征图的尺寸
print(output.size())


relu = nn.ReLU(inplace=True)
input = t.randn(2, 3)
print(input)
output = relu(input)
print(output) # 小于0的都被截断为0
# 等价于input.clamp(min=0)